package com.huawei.java.main;



import com.huawei.java.main.deployentity.Vm;
import com.huawei.java.main.inputentity.VmType;

import java.util.*;

public class Test {
    public static void main(String[] args) {
//        Test t = new Test();
//        boolean res = t.ReachingPoints(new int[]{1,1},new int[]{5,2});
//        System.out.println(res);

        reverseBits(00010120);

    }
    static int reverseBits(long n) {
        String s=n+"";
        String[] str = s.split("");
        StringBuffer sb = new StringBuffer();
        for(int i=str.length-1;i>=0;i--){
            sb.append(str[i]);
        }
        return Integer.parseInt(sb.toString());

    }
    static int maxEvents(int[][] events) {
        List<int[]> list = Arrays.asList(events);
        list.sort((o1, o2) -> o1[0]-o2[0]);
        int[] i =list.get(list.size()-1);

        //结束时间升序
        Queue<int[]> q = new PriorityQueue<>((o1,o2)->o1[1]-o2[1]);
        for (int[] ints : events) q.offer(ints);
        int startDay=0,endDay=0,count=0;
        while(q.size()!=0){
            int[] event = q.poll();
            if(event[0]<endDay) continue;//开始时间小于当前结束时间
            endDay=event[1];//加入当天会议
            count++;
        }
        return count;

    }

    public boolean ReachingPoints(int[] start, int[] target) {
        // write your code here
        return func(start,target);
    }
    boolean func(int[] coord,int[] target){
        if(coord[0]==target[0]&&coord[1]==target[1]){
            return true;
        }
        while(coord[0]+coord[1]<=target[0]&&coord[0]+coord[1]<=target[1]){
            coord[0]+=coord[1];
            if (func(coord,target)) return true;
            coord[0]-=coord[1];

            coord[1]+=coord[0];
            if(func(coord,target)) return true;
            coord[1]-=coord[0];
        }
        return false;
    }

}
